package edu.mit.media.fv.blocks
{
	import edu.mit.media.fv.fluidspace.FluidSpace;
	import edu.mit.media.fv.components.*;
	import edu.mit.media.fv.fluidspace.*;
	import edu.mit.media.fv.icons.AQUserIcon;
	
	import flash.display.DisplayObject;
	import flash.display.GradientType;
	import flash.display.InterpolationMethod;
	import flash.display.SpreadMethod;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	import flash.text.*;
	import flash.filters.*;
	public class CircleBlock extends Block
	{
		public function CircleBlock(model:Model, controller:FluidSpace, icon:DisplayObject = null, text:String = "", color:uint = 0xFFFFFF)
		{
			super(model, controller, icon, text, color);
			this.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
			this.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
		}
		
		public override function draw():void{
			var type:String = GradientType.RADIAL;
			var colors:Array = [this.color, SHADOW];
			var alphas:Array = [1, 1];
			var ratios:Array = [0, 255];
			var spreadMethod:String = SpreadMethod.PAD;
			var interp:String = InterpolationMethod.LINEAR_RGB;
			var focalPtRatio:Number = 0;
			
			var matrix:Matrix = new Matrix();
			var boxWidth:Number = this.radius*4;
			var boxHeight:Number = this.radius*4;
			var boxRotation:Number = 0;//Math.PI/2; // 90˚
			var tx:Number = -this.radius*1.5;
			var ty:Number = -this.radius*1.5;
			matrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);
			
			this.graphics.clear();
			this.graphics.beginGradientFill(type, colors, alphas, ratios, matrix,
				spreadMethod,interp, focalPtRatio);
			this.graphics.drawCircle(this.radius, this.radius, this.radius-3);
			this.graphics.endFill();
			
			var glow:GlowFilter = new GlowFilter(0xFFFFFF,0.4,50,50);
			var bevel:BevelFilter = new BevelFilter();
			this.filters = [bevel];
			
		}
		
	}
}